﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FMSpaceShooter.Screens;
using Microsoft.Xna.Framework;

namespace FMSpaceShooter.GameObjects
{
    class ExplosiveBullet: BulletBase
    {
        public new const string TypeName = "ExplosiveBullet";
        public new const bool IsStandardBullet = true;

        public const string imageName = "Images/Bullets/ExplosionBullet";
        public const int rof = 190;
        public override int Damage { get { return 40 + damageBoost ; } }
        public override int RateOfFire { get { return rof; } }
        public const int MaxVelocity = 1000;
        private static int bulletLevel=0;
        private int damageBoost;
        public static int BulletLevel { get { return bulletLevel; } }

        public ExplosiveBullet(GameplayScreen screen, Vector2 initial, float rotation)
            : base(screen, imageName)
        {
            this.position = initial;
            this.rotation = rotation;
            damageBoost = 40 + bulletLevel / 10;
        }

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            position += (float)(MaxVelocity * gameTime.ElapsedGameTime.TotalSeconds) * Util.Tools.AngleToVector(rotation);
        }

        public override void Hit(int damage)
        {
            Die();

           screen.GOM.AddToPlay(new Explosion(screen, position, rotation,bulletLevel));

        }

        public static void increaseLevel()
        {
            if (bulletLevel < 10)
            {
                bulletLevel++;
            }
        }

        public static void resetLevel()
        {
            bulletLevel = 0;
        }

        

    }

    class Explosion : BulletBase
    {

        public const string imageName = "Images/Bullets/Explosion1";
        public const int rof = 100;
        public override int Damage { get { return 20+damageBoost; } }
        public override int RateOfFire { get { return rof; } }
        public const int MaxVelocity = 0;
        public double timeShot;
        private int damageBoost;


         public Explosion(GameplayScreen screen, Vector2 initial, float rotation,int multiplier)
            : base(screen, imageName, new Vector2(150 + (150 * multiplier / 5), 150 + (150 * multiplier / 5)))
        {
            this.position = initial;
            this.rotation = rotation;
            timeShot = 0;
            damageBoost = 20 * multiplier / 10;
        }

         public override void Update(GameTime gameTime)
         {
             base.Update(gameTime);
             Die();
             

         }

         public override void Hit(int damage)
         {
            
         }

    }
}
